package cn.itlaobing.service;

import cn.itlaobing.dao.RegisterDao;
import cn.itlaobing.exception.MyException;
import cn.itlaobing.model.UsersModel;

import java.sql.SQLException;

/**
 * Created by Administrator on 2017-11-15.
 */
public class RegisterService {
    private RegisterDao registerDao=new RegisterDao();
    public Boolean isRegister(String phone) throws MyException {
        try {
            return registerDao.isRegister(phone);
        } catch (SQLException e) {
            e.printStackTrace();
            throw new MyException(e.getMessage());
        }
    }
    public int Register(UsersModel usersModel) throws MyException {
        try {
            return registerDao.Register(usersModel);
        } catch (SQLException e) {
            e.printStackTrace();
            throw new MyException(e.getMessage());
        }
    }
    public UsersModel login(String username,String password) throws MyException {
        try {
            return registerDao.login(username,password);
        } catch (SQLException e) {
            e.printStackTrace();
            throw new MyException(e.getMessage());
        }
    }
    public int updateLastTime(Integer count,Integer id) throws MyException {
        try {
            return registerDao.updateLastTime(count,id);
        } catch (SQLException e) {
            e.printStackTrace();
            throw new MyException(e.getMessage());
        }
    }
}
